]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
switcherPopup: Factor the initial selection into the base class
authorRui Matos <tiagomatos@gmail.com>
Wed, 3 Sep 2014 15:17:26 +0000 (17:17 +0200)
committerRui Matos <tiagomatos@gmail.com>
Thu, 11 Sep 2014 17:12:17 +0000 (19:12 +0200)
Only the application switcher needs to keep its own implementation
since it has two modes of operation depending on the binding.

https://bugzilla.gnome.org/show_bug.cgi?id=735976

js/ui/altTab.js
js/ui/ctrlAltTab.js
js/ui/status/keyboard.js
js/ui/switcherPopup.js

index b11c4f13f1657cd5a85db3ea3584d1ae13a99d0f..cee81b0e10d13b78ce571d75ac73e6d6d63ac54d 100644 (file)
@@ -378,15 +378,6 @@ const WindowSwitcherPopup = new Lang.Class({
         return global.display.get_tab_list(Meta.TabList.NORMAL, workspace);
     },
 
-    _initialSelection: function(backward, binding) {
-        if (binding == 'switch-windows-backward' || backward)
-            this._select(this._items.length - 1);
-        else if (this._items.length == 1)
-            this._select(0);
-        else
-            this._select(1);
-    },
-
     _keyPressHandler: function(keysym, action) {
         if (action == Meta.KeyBindingAction.SWITCH_WINDOWS) {
             this._select(this._next());
index 85e39dfbc7a099c4c0d1089c7aef018bb4f8b379..56949907c85a4287e5ac08db57d610ecb131645a 100644 (file)
@@ -146,17 +146,6 @@ const CtrlAltTabPopup = new Lang.Class({
         this._switcherList = new CtrlAltTabSwitcher(this._items);
     },
 
-    _initialSelection: function(backward, binding) {
-        if (binding == 'switch-panels') {
-            if (backward)
-                this._selectedIndex = this._items.length - 1;
-        } else if (binding == 'switch-panels-backward') {
-            if (!backward)
-                this._selectedIndex = this._items.length - 1;
-        }
-        this._select(this._selectedIndex);
-    },
-
     _keyPressHandler: function(keysym, action) {
         if (action == Meta.KeyBindingAction.SWITCH_PANELS)
             this._select(this._next());
index ea02f6f8fd3a46ad47e1d3d50d62a46df3ad6f6e..4bb92252f6c4a4c62b75b4c25e19af0027c6a60d 100644 (file)
@@ -269,17 +269,6 @@ const InputSourcePopup = new Lang.Class({
         this._switcherList = new InputSourceSwitcher(this._items);
     },
 
-    _initialSelection: function(backward, binding) {
-        if (binding == 'switch-input-source') {
-            if (backward)
-                this._selectedIndex = this._items.length - 1;
-        } else if (binding == 'switch-input-source-backward') {
-            if (!backward)
-                this._selectedIndex = this._items.length - 1;
-        }
-        this._select(this._selectedIndex);
-    },
-
     _keyPressHandler: function(keysym, action) {
         if (action == this._action)
             this._select(this._next());
index c9d3884b947899b15456f139fc0f21123eeb1644..24ad27904cec6da210af3579ad9b41090f1535a4 100644 (file)
@@ -103,7 +103,12 @@ const SwitcherPopup = new Lang.Class({
     },
 
     _initialSelection: function(backward, binding) {
-        throw new Error('Not implemented');
+        if (backward)
+            this._select(this._items.length - 1);
+        else if (this._items.length == 1)
+            this._select(0);
+        else
+            this._select(1);
     },
 
     show: function(backward, binding, mask) {
@@ -135,11 +140,6 @@ const SwitcherPopup = new Lang.Class({
         this.actor.show();
         this.actor.get_allocation_box();
 
-        if (this._items.length > 1)
-            this._selectedIndex = 1;
-        else
-            this._selectedIndex = 0;
-
         this._initialSelection(backward, binding);
 
         // There's a race condition; if the user released Alt before